function Fig=PlotPerformanceBoxLegendV3(Fig)
%% Check Figure handel
if nargin<1
    a=figure();
    Fig.Fig=a;
end
if isnumeric(Fig)
    Temp=Fig;
    clear Fig
    Fig.Fig=Temp;
end
%% Text
if ~isfield(Fig,'TextSize')
    Fig.TextSize=14;
end
%%
if ~isfield(Fig,'AreaLegendsName')
    Fig.AreaLegendsName(1,:)={'Extreme Error','Considerable Error','Transition','Slight Error','Tolerable Error'};
    Fig.AreaLegendsName(2,:)={11,1,2,3,10};
end

%% Color Map and Colorbar
if ~isfield(Fig,'ColorMAP')
    Fig.ColorMAP=[0.9,0.1,0.1
                  0.8,0.4,0.8
                  0.4,0.4,1.0
                  0.8,0.4,0.8
                  0.0,0.5,0.0
                  0.8,0.4,0.8
                  0.4,0.4,1.0
                  0.8,0.4,0.8
                  0.9,0.1,0.1
                  0.0,1.0,0.0
                  0.1,0.1,0.1
                  0.1,0.1,0.1];
end
if ~isfield(Fig,'ColorRenge')
    Fig.ColorRenge=[1,12];
end
%% Correct Axis
if isfield(Fig,'Fig')
    figure(Fig.Fig)
else
    figure()
end

if isfield(Fig,'SubFig')
    if length(Fig.SubFig)==3
        subplot(Fig.SubFig{1},Fig.SubFig{2},Fig.SubFig{3})
    else
        subplot(Fig.SubFig)
    end
end
cla;
%%
x=[0.1,0.3,0.3,0.1,0.1];
y0=[0.1,0.1,0.25,0.25,0.1]-0.05;
y=y0;
hold on
for i=1:2
fill(x,y,Fig.ColorMAP(Fig.AreaLegendsName{2,i},:))
text(0.35,y(1)+0.05,Fig.AreaLegendsName{1,i})
y=y+0.2;
end
y=y0;
x=x+0.5;
for i=3:5
fill(x,y,Fig.ColorMAP(Fig.AreaLegendsName{2,i},:))
text(0.85,y(1)+0.05,Fig.AreaLegendsName{1,i})
y=y+0.2;
end

hold off
colormap(Fig.ColorMAP);
caxis(Fig.ColorRenge);

set(gca,'Visible','off')
xlim([0,1]);
ylim([0,1]);

